<template>
	<view >
		<view class="index_wrap" :style="'minHeight:'+(windowHeight+80)+'px'">
			<shopTrick v-show="showTop"></shopTrick>
			<view  :class="'search_tab '+(!showTop?'search_tabfixed':'')" @click="goSearch">
				 <view class="top_search" style="width: 100%;">
					 <label style="width: 100%;">搜索店铺内商品</label>
				 </view> 
			</view>
			<goods :topFixed = 'topFixed' :changPage ='changPage'></goods>
			 <view class="zw_block"></view>
			<tabbar :tranfState = 'tranfState'></tabbar>
		</view> 
	</view>
</template>

<script>
	import shopTrick from '../components/shopTrick/shopTrick'
	import tabbar from '../components/tabbar/tabbar'  
	import goods from '../store_home/goods'
	var common = require('../../../utils/common.js');
	// var mall_common = require('../../mall/js/common.js');
	const { windowWidth, windowHeight,screenHeight } = uni.getSystemInfoSync();
	var app = getApp(); 
	var shop_common = require('../../../utils/shop/common.js');
	var store_id
	export default{
		data(){
			return{
				showTop:true,
				topFixed:false,
				windowHeight:windowHeight,
				tranfState:'allGoods',
				changPage:0
			}
		},
		components:{
			shopTrick, 
			tabbar,
			goods
		},
		onLoad(option){  
			console.log(option)  
			store_id = option.store_id
			// mall_common.initData(store_id);
			// if(!store_id){
			//  shop_common.getStorage('store_id').then(data=>{
			//  	console.log(data)
			//  	store_id = data 
			//  })	  
			//  shop_common.getStorage('pageInfo').then(pageInfo=>{ 
			//  	if(pageInfo.store_id == store_id ){
			//  		this.pageInfo = pageInfo 
			//  	}else{
					
			// 	}
			//  }) 
			// }  
		},
		mounted(){ 
			// shop_common.getStorage('store_id').then(data=>{
			// 	console.log(data)
			// 	store_id = data 
			// })
		},
		onReachBottom(){  
			this.changPage++
			// console.log('onReachBottomonReachBottom')
		},
		methods:{ 
			onPageScroll:function(e){
				console.log('onPageScroll allgoods') 
				if(e.scrollTop >10){
					this.showTop = false
					this.topFixed = true
				}else{
					this.showTop = true
					this.topFixed = false
				} 
			},
			goSearch(){
				mall_common.goSearch(store_id)
			}
			
		}
	}
</script>

<style>
	@import url("../css/mall.css");
	.search_tab{
		width: auto;
		right: 10px;
		top:0px;
		margin-top: 78px;
	}
	.search_tabfixed{
		top:0;
	    padding: 10px;
		width: 100%;
		margin-top: 0;
		box-sizing: border-box;
	}
 
</style>
